package study.zhangbo.lock.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import study.zhangbo.lock.distributed.IBaseLockerService;
import study.zhangbo.lock.commons.ThreadPools;
import study.zhangbo.lock.tests.TestThread;

@RestController
public class TestController {

    @Autowired
    private IBaseLockerService baseLockerService;

    @GetMapping("/test")
    public Object test() {
        for (int i = 0; i < 20; i++) {
            ThreadPools.THREAD_POOL_EXECUTOR.execute(new TestThread(baseLockerService));
        }
        return "success";
    }
}